jQuery(document).ready(function() {

	
	jQuery('#checkOrderTable').dataTable({
		"sPaginationType": "full_numbers",
		"oLanguage": {
			"sLengthMenu": "每页显示 _MENU_ 条记录",
			"sZeroRecords": "抱歉， 没有找到",
			"sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
			"sInfoEmpty": "没有数据",
			"sInfoFiltered": "(从 _MAX_ 条数据中检索)",
			"sSearch":"全文搜索:",
			"oPaginate": {
			"sFirst": "首页",
			"sPrevious": "前一页",
			"sNext": "后一页",
			"sLast": "尾页",
			},
			"sZeroRecords": "没有检索到数据",
			"sProcessing": "<img src='./loading.gif' />"
		},
		"aaSortingFixed": [[0,'asc']],
		"fnDrawCallback": function(oSettings) {
            jQuery('input:checkbox,input:radio').uniform();
        }
	});
	
	jQuery('input:checkbox,input:radio').uniform();
	
	jQuery("#check_pass").click(function() {
		var checkboxes = jQuery("#checkOrderTable").find('tbody input[type=checkbox]');
		var ids = [];
		checkboxes.each(function(){ 
			if(jQuery(this).is(':checked')) {
				ids.push(jQuery(this).val());
			}	
		});
		jQuery.ajax({
			   type: "post",
			   url: "/cms/order/pass",
			   dataType:"json",
			   data: {id: ids.join(',')},
			   success: function(data){
				   if(data.flag == true) {
					   window.location.reload();
					   jQuery.jGrowl("恭喜您，审核预订通过成功！");
				   } else {
					   jQuery.jGrowl("很抱歉，审核预订通过失败！");
				   }
				   
			   },
				error:function(e) {  
					jQuery.jGrowl("很抱歉，审核预订通过失败！");
		        }
			 });
	});
	
	jQuery("#check_fail").click(function() {
		var checkboxes = jQuery("#checkOrderTable").find('tbody input[type=checkbox]');
		var ids = [];
		checkboxes.each(function(){ 
			if(jQuery(this).is(':checked')) {
				ids.push(jQuery(this).val());
			}	
		});
		jQuery.ajax({
			   type: "post",
			   url: "/cms/order/notPass",
			   dataType:"json",
			   data: {id: ids.join(',')},
			   success: function(data){
				   if(data.flag == true) {
					   window.location.reload();
					   jQuery.jGrowl("恭喜您，审核预订不通过成功！");
				   } else {
					   jQuery.jGrowl("很抱歉，审核预订不通过失败！");
				   }
				  
			   },
				error:function(e) {
					jQuery.jGrowl("很抱歉，审核预订不通过失败！");
		        }
			 });
	});
});

